{include file='_header'}

<div class="page-header">
    当前位置：<span class="text-primary">{if !empty($notice['id'])}编辑{else}添加{/if}公告{if !empty($notice['id'])}({$notice['title']}){/if}</span>
</div>

<div class="page-content">
    <div class="page-sub-toolbar">
        <span class=''>
            <a class="btn btn-primary btn-sm" href="{:url('merch/shop/noticeadd')}">添加新公告</a>
        </span>
    </div>
    <form action="" method="post" class="form-horizontal form-validate" enctype="multipart/form-data" onsubmit='return formcheck()'>
        <input type="hidden" name="id" value="{$notice['id']}" />
        <div class="form-group">
            <label class="col-lg control-label">排序</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="displayorder" class="form-control" required="required" value="{$notice['displayorder']}" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label must">公告标题</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" id='title' name="title" class="form-control" value="{$notice['title']}" data-rule-required='true' />
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label">公告图片</label>
            <div class="col-sm-9 col-xs-12">
                {:tpl_form_field_image2('thumb', $notice['thumb'])}
                <span class="help-block">正方型图片</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label">连接</label>
            <div class="col-sm-9 col-xs-12">
                <div class="input-group form-group" style="margin: 0;">
                    <input type="text" name="link" class="form-control" value="{$notice['link']}" id="noticelink" />
                    <span class="input-group-btn">
                        <span data-input="#noticelink" data-toggle="selectUrlMerch" class="btn btn-default">选择链接</span>
                    </span>
                </div>
                <span class="help-block">如果输入链接，则不显示内容，直接跳转</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label">公告内容</label>
            <div class="col-sm-9 col-xs-12">
                {:tpl_ueditor('detail',$notice['detail'],array('height'=>350))}
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label">属性</label>
            <div class="col-sm-9 col-xs-12">
                <label class='radio-inline'>
                    <input type='radio' name='cate' value='公告' {if $notice['cate']=='公告'}checked{/if} /> 公告
                </label>
                <label class='radio-inline'>
                    <input type='radio' name='cate' value='通知' {if $notice['cate']=='通知'}checked{/if} /> 通知
                </label>
                <label class='radio-inline'>
                    <input type='radio' name='cate' value='优惠' {if $notice['cate']=='优惠'}checked{/if} /> 优惠
                </label>
                <label class='radio-inline'>
                    <input type='radio' name='cate' value='折扣' {if $notice['cate']=='折扣'}checked{/if} /> 折扣
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label">是否开启</label>
            <div class="col-sm-9 col-xs-12">
                <label class='radio-inline'>
                    <input type='radio' name='status' value=1' {if $notice['status']==1}checked{/if} /> 是
                </label>
                <label class='radio-inline'>
                    <input type='radio' name='status' value=0' {if $notice['status']==0}checked{/if} /> 否
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <input type="submit"  value="提交" class="btn btn-primary"  />
                <input type="button" name="back" onclick='history.back()' style='margin-left:10px;' value="返回列表" class="btn btn-default" />
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    $('form').submit(function(){
        var thumb = $("input[name='thumb']").val();
        if(thumb==''){
            tip.msgbox.err("请填写上传图片");
            return false;
        }
        return true;
    });
</script>
{include file='_footer'}